<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <div id="box" style="width: 200px;height: 200px; background-color:red"></div>
  <script>
    const obox = document.querySelector('#box');
    const reader = new FileReader();
    reader.onload = function () {
      console.log(reader.result)
    }
    function hanlde(e) {
      e.preventDefault();
      if (e.type === "drop") {
        console.log(e)
        reader.readAsText(e.dataTransfer.files[0])
      }
    }
    obox.addEventListener('dragenter', hanlde, false)
    obox.addEventListener('dragover', hanlde, false)
    obox.addEventListener('drop', hanlde, false)
  </script>
</body>

</html>